<template>
  <div id="header">
    编号：<input type="text" v-model="obj.id" /> 品牌名称：<input
      type="text"
      v-model="obj.brand"
    /><br />
    产品图片地址：<input type="text" v-model="obj.Image" /> 价格：<input
      type="text"
      v-model="obj.price"
    />
    <button @click="inputdate">添加</button>
  </div>
</template>


<script>
export default {
  data() {
    return {
      obj: {
        Image: null,
        id: null,
        brand: null,
        price: null,
        num: 1,
      },
    };
  },
  methods: {
    inputdate() {
      //   if (!this.Image || !this.id || !this.brand || !this.price) {
      //     alert("不能有空");
      //     return;
      //   }
      this.$bus.$emit("get", this.obj);
      console.log(1);
      this.obj = {
        Image: null,
        id: null,
        brand: null,
        price: null,
        num: 1,
      };
    },
  },
};
</script>

<style>
#header {
  margin-bottom: 20px;
  border: 2px solid;
  width: 596px;
}
</style>